package com.lzy.product.service.impl;

import com.lzy.framework.core.utils.DozerUtils;
import com.lzy.product.dao.AgentProductImageTextMapperExt;
import com.lzy.product.dtos.agent.AgentProductImageTextDto;
import com.lzy.product.entity.AgentProductImageText;
import com.lzy.product.service.AgentProductImageTextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AgentProductImageTextServiceImpl implements AgentProductImageTextService {

    @Autowired
    AgentProductImageTextMapperExt agentProductImageTextMapperExt;

    @Override
    public Long insert(AgentProductImageTextDto dto) {
        AgentProductImageText agentProductImageText = DozerUtils.map(dto, AgentProductImageText.class);
        return agentProductImageTextMapperExt.insertSelective(agentProductImageText) > 0 ? agentProductImageText.getId() : 0;
    }

    @Override
    public Boolean update(AgentProductImageTextDto dto) {
        return agentProductImageTextMapperExt.updateByPrimaryKeySelective(DozerUtils.map(dto,AgentProductImageText.class))>0;
    }

    @Override
    public Boolean delete(Long id) {
        return null;
    }

    @Override
    public Boolean remove(Long id) {
        return null;
    }

    @Override
    public Boolean deleteByProductId(Long productId) {
        return agentProductImageTextMapperExt.deleteByProductId(productId)>0;
    }

    @Override
    public AgentProductImageTextDto findById(Long id) {
        return null;
    }

    @Override
    public List<AgentProductImageTextDto> query(AgentProductImageTextDto dto) {
        return null;
    }

    @Override
    public List<AgentProductImageTextDto> queryAgentProductImageText(Long productId) {
        return agentProductImageTextMapperExt.queryAgentProductImageTextByProductId(productId);
    }
}
